function insert_row(tbody, no_cols, html, attrs) {
	var tbody_obj = document.getElementById(tbody);

	var tr = document.createElement('tr');

	for (var i=0; i<no_cols; i++)
	{
		var td = document.createElement('td');
		
		var text_div = document.createTextNode("");

		if (typeof (html[i]) != 'undefined' )
		{
			//alert(html[i]);
			text_div = document.createElement('div');
			text_div.innerHTML = html[i];
		}

		//Add DIV to TD
		td.appendChild(text_div);
		
		//sets the attribute of TD
		if (typeof (attrs[i]) != 'undefined' )
		{
			for (var key in attrs[i]) 
			{
				//alert(key+":"+attrs[i][key]);
				td.setAttribute(key, attrs[i][key]);
			}
		}

		//Add TD to TR
		tr.appendChild(td);

	}
	//Add TR to TBODY
	tbody_obj.appendChild(tr);
}

function add_website() {
 
	var attrs = new Array();
	var html = new Array();

	attrs[0] = {"align":"left"};
	attrs[1] = {"align":"left"};
	
	if (num_urls >= 10)
	{
		//alert("Only 10 allowed");
	} else 
	{

		num_urls++;

		html[0] = '#'+num_urls;
		html[1] = '<input name="pageurls[]" id="pageurls" value="" type="text" class="input" size="40" />';
		
		insert_row('tbody2', 2, html, attrs);
	}

}

function add_keyword() {
 
	var attrs = new Array();
	var html = new Array();

	attrs[0] = {"align":"left"};
	attrs[1] = {"align":"left"};
	
	if (num_keys >= 10)
	{
		//alert("Only 10 allowed");
	} else 
	{

		num_keys++;

		html[0] = '#'+num_keys;
		html[1] = '<input name="keywords[]" id="keywords" value="" type="text" class="input" size="40" />';
		
		insert_row('tbody1', 2, html, attrs);
	}

}

function progress_bar(total, current, div) {

	var out = '';

	for (var i=1; i<=total; i++ )
	{
		if (i <= current)
		{
			out += '<font color="#0000FF"><b>*</b></font>';
		}
		else
		{
			out += '<font color="#E5E5E5"><b>*</b></font>';
		}
	}

	document.getElementById(div).innerHTML = out;
}